<?php

  // If the session var is empty, show any error message and the log-in form; otherwise confirm the log-in
  if (empty($_SESSION['id'])) {
  	if(isset($error_msg)) {
	    echo '<p class="error">' . $error_msg . '</p>';
    }
?>

  <form id="loginform" method="post" action="index.php?act=login">
		<ul>
	      <ol><label id="userloginform"for="username">Username:</label></ol>
	      <ol><input type="text" name="username" value="<?php if (!empty($user_username)) echo $user_username; ?>" /></ol>
	      <ol><label for="password">Password:</label></ol>
	      <ol><input type="password" name="password" /></ol>
	      <ol><input type="submit" value="Log In" name="submit" /></ol>
      </ul>
  </form>

<?php
  }
  else {
    // Confirm the successful log-in
    //echo "<meta http-equiv='refresh' content='0; url=index.php'/>";
    echo('<p class="text">You are logged in as ' . $_SESSION['username'] . '.</p>');
  }
?>
